package leetcode;

import org.junit.Test;

import java.util.Stack;

/**
 * @author Liangyaoyun
 */
public class MyDecimalConversion {
    @Test
    public void test01() {
        Integer target = 80;
        Stack<String> stack = new Stack<>();
        String result;
        String[] s = new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O"
                , "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
        //将target的商入栈
        while (target != 0) {
            Integer res= target%36;
            target=target/36;
            if (res < 35) {
                if (res <= 9) {
                    result = res.toString();
                    stack.push(result);
                } else {
                    result = s[res - 10];
                    stack.push(result);
                }
            }
        }
        while (!stack.isEmpty()){
            System.out.print(stack.pop());
        }
    }
}
